package org.sfgeeq.chapter2.controller;

import org.sfgeeq.chapter2.model.Customer;
import org.sfgeeq.chapter2.service.CustomerService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * 创建客户
 * Created by  on 2016/8/25.
 */
@WebServlet("/customer_create")
public class CustomerCreateServlet extends HttpServlet {
private CustomerService customerService;

    @Override
    public void init() throws ServletException{
        customerService=new CustomerService();
    }
    /**
     * 进入 创建客户 页面
     */
    @Override
    protected void doGet(HttpServletRequest req,HttpServletResponse resp) throws ServletException,IOException{
        List<Customer> list=customerService.getCustomerList("");
        req.setAttribute("customerList",list);
        req.getRequestDispatcher("/WEB-INF/view/customer.jsp").forward(req,resp);
    }
    /**
     * 处理 创建客户 页面
     */
    @Override
    protected void doPost(HttpServletRequest ret,HttpServletResponse resp) throws ServletException,IOException{

    }

}
